package com.wangzh.nio.mytest;

import java.io.*;

public class Test2 {
    public static void main(String[] args) throws IOException {
//        encry();
        decode();
    }

    private static void decode() throws IOException {
        //        解密
        FileInputStream fis = new FileInputStream("D:\\learn\\encry.png");
        FileOutputStream fos = new FileOutputStream("D:\\learn\\decode.png");

        int temp;
        while ((temp = fis.read()) != -1) {

            fos.write(temp^10);
        }

        fos.close();
        fis.close();
    }

    private static void encry() throws IOException {
        //        加密
        FileInputStream fis = new FileInputStream("D:\\learn\\a.png");
        FileOutputStream fos = new FileOutputStream("D:\\learn\\encry.png");

        int temp;
        while ((temp = fis.read()) != -1) {
            fos.write(temp^10);
        }
        fos.close();
        fis.close();

    }
}
